package com.zxn.japp;

import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;

import butterknife.BindView;
import butterknife.ButterKnife;

@Route(path = IARouterConfig.HOME_MENU_ACTIVITY_URL)
public class MenuActivity extends AppCompatActivity {

    @BindView(R.id.tv_text)
    TextView tvText;

    //必须制定传递过来的参数名称，然后进行自动装载
    @Autowired(name = "age")
    int age;
    @Autowired(name = "name")
    String name;
    @Autowired(name = "amount")
    double amount;
    @Autowired(name = "loginResult")
    boolean loginResult;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);
        ButterKnife.bind(this);
        ARouter.getInstance().inject(this);
        String text = "姓名: " + name + ", 年龄: " + age + ", 余额: " + amount + ", 登录结果: " + loginResult;
        Toast.makeText(this,
                text,
                Toast.LENGTH_LONG)
                .show();
        tvText.setText(text);
    }

}